package configuration.dataObjects
{
	import mx.collections.ArrayCollection;
	[Bindable]
	public class LocationSelectionDO
	{
		public var OBJECT_ID:String = "0";
		public var LOC_SEL_ID:String = "";
		public var LOC_SEL_DESC:String = "";
		public var SQL_STATEMENT:String = null;
		public var LOC_SEL_TYPE:String = "L";

		public function LocationSelectionDO()
		{		
		}
	
		public function Init(xmlObj:XML):void{				
			if(null == xmlObj)
				return;
			else{
				for each (var itemProp:XML in xmlObj.children()) {			
					this[itemProp.name()] = itemProp;
				}
			}
		}
		
		public function ToXML():XML{
			var xmlObj:XML =
				<LOCATION_SELECTION>
					<OBJECT_ID>{OBJECT_ID}</OBJECT_ID>
					<LOC_SEL_ID>{LOC_SEL_ID}</LOC_SEL_ID>
					<LOC_SEL_DESC>{LOC_SEL_DESC}</LOC_SEL_DESC>
					<SQL_STATEMENT>{SQL_STATEMENT}</SQL_STATEMENT>
					<LOC_SEL_TYPE>{LOC_SEL_TYPE}</LOC_SEL_TYPE>
				</LOCATION_SELECTION>;
			return xmlObj;
		}
		
		public static function getItems(list:XMLList):ArrayCollection
		{
			var ac:ArrayCollection = new ArrayCollection();
			for each(var xml:XML in list)
			{
				var itm:LocationSelectionDO = new LocationSelectionDO();
				itm.Init(xml);
				ac.addItem(itm);
			}
			return ac;
		}
	}
}